/* 
 * Enterprise Library Extensions - DI + ORM.
 * Copyright (C) 2006
 *
 * GNU General Public License
 *
 * This program is free software; you can redistribute 
 * it and/or modify it under the terms of the GNU General Public License 
 * as published by the Free Software Foundation; either version 2 of the 
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but 
 * WITHOUT ANY WARRANTY; without even the implied warranty of 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
 * See the GNU General Public License for more details.
 */
using System;

namespace ELE.EnterpriseLibrary.Naming.Spi
{
	/// <summary>
  /// This interface represents an "intermediate context" for name resolution. 
  /// <br/><br/>The IResolver interface contains methods that are implemented by contexts that do not support 
  /// subtypes of IContext, but which can act as intermediate contexts for resolution purposes. 
  /// <br/><br/>A IName parameter passed to any method is owned by the caller. The service provider will not 
  /// modify the object or keep a reference to it. A ResolveResult object returned by any method is owned by 
  /// the caller. The caller may subsequently modify it; the service provider may not. 
	/// </summary>
	public interface IResolver
	{
    /// <summary>
    /// Partially resolves a name. Stops at the first context that is an instance of a given subtype of Context.
    /// </summary>
    /// <param name="name">the name to resolve</param>
    /// <param name="contextType">the type of object to resolve. This should be a subtype of Context</param>
    /// <returns>the object that was found, along with the unresolved suffix of name. Cannot be null.</returns>
    /// <exception cref="NotContextException">if no context of the appropriate type is found</exception>
    /// <exception cref="NamingException">if a naming exception was encountered</exception>
    ResolveResult ResolveToClass(IName name, Type contextType);
    /// <summary>
    /// Partially resolves a name. See ResolveToClass(IName, Class) for details.
    /// </summary>
    /// <param name="name">the name to resolve</param>
    /// <param name="contextType">the type of object to resolve. This should be a subtype of Context</param>
    /// <returns>the object that was found, along with the unresolved suffix of name. Cannot be null.</returns>
    /// <exception cref="NotContextException">if no context of the appropriate type is found</exception>
    /// <exception cref="NamingException">if a naming exception was encountered</exception>
    ResolveResult ResolveToClass(string name, Type contextType);

	}
}
